package com.briup.app02.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.briup.app02.bean.BaseUserRole;
import com.briup.app02.bean.BaseUserRoleExample;
import com.briup.app02.dao.BaseUserRoleMapper;
import com.briup.app02.service.IBaseUserRoleService;

@Service

public class BaseUserRoleServiceImpl implements IBaseUserRoleService{
	@Autowired
	private BaseUserRoleMapper baseuserrolemapper;

	@Override
	public List<BaseUserRole> findInfo(Long roleId) {
		BaseUserRoleExample example = new BaseUserRoleExample();
		BaseUserRoleExample.Criteria criteria=example.createCriteria(); 
		if (roleId != null) {
			criteria.andRoleIdEqualTo(roleId);
		}
		return baseuserrolemapper.selectByExample(example);
	}

	@Override
	public BaseUserRole findById(long id) {
		return baseuserrolemapper.selectByPrimaryKey(id);
	}

	@Override
	public void SaveOrUpdate(BaseUserRole baseuserrole) {
		if(baseuserrole.getId() == null) {
			baseuserrolemapper.insert(baseuserrole);
		} else {
			baseuserrolemapper.updateByPrimaryKey(baseuserrole);
		}
	}

	@Override
	public void deleteById(long id) {
		baseuserrolemapper.deleteByPrimaryKey(id);
	}
	
}
